'use strict';

const httpCode = require('./httpCode');

module.exports={
    sendRes(ctx,{code=200,data={},msg=''}={}){
        if(code === 200){
            ctx.body={
                code:"SUCCESS",
                status:code,
                msg:msg||'success',
                data,
            };
            return;
        }
        ctx.status=code;
        
        ctx.body={
            code:"FAIL",
            status:code,
            msg:msg||httpCode[code],
            data,
        }
    }
}